<template>
  <div class="container-content programme">
    <el-row>
      <el-col :span="24">
        <h3 class="panel-title">编辑测算</h3>
      </el-col>
    </el-row>
    <el-card shadow="never">
      <el-form
        ref="formRef"
        :model="formObject"
        label-width="110px"
        label-position="left"
        class="programme-form"
      >
        <el-form-item label="项目名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="项目编码">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="客户名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="需求名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="勘测报告Id">
          <el-input v-model="formObject.surveyReportId"></el-input>
        </el-form-item>
        <el-form-item label="屋顶方">
          <el-input v-model="formObject.roof"></el-input>
        </el-form-item>
        <el-form-item label="公司项目类型">
          <el-input v-model="formObject.projectType"></el-input>
        </el-form-item>
        <el-form-item label="	预计装机容量">
          <el-input v-model="formObject.planInstalledCapacity"></el-input>
        </el-form-item>
        <el-form-item label="	是否为自投">
          <el-radio v-model="formObject.isSelf" :label="1" border>是</el-radio>
          <el-radio v-model="formObject.isSelf" :label="2" border>否</el-radio>
        </el-form-item>
        <el-form-item label="消纳比例">
          <el-input v-model="formObject.consumeRate"></el-input>
        </el-form-item>
        <el-form-item label="评估意见">
          <el-input v-model="formObject.assess"></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="formObject.remarks" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label="附件">
          <el-upload
            class="upload-demo"
            ref="upload"
            action="#"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            :file-list="fileList"
            :auto-upload="false"
          >
            <el-button slot="trigger" size="small" type="primary"
              ><i class="el-icon-plus"></i>添加</el-button
            >
          </el-upload>
        </el-form-item>
        <el-form-item label-width="0px">
          <el-button type="primary" @click="onSubmit">保存</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>
<script>
import { editRevenueList, getDetailRevenueList } from "@/api/system/survey";
export default {
  data() {
    return {
      formObject: {
        assess: "",
        changeTime: "",
        consumeRate: "",
        createBy: "",
        createTime: "",
        customerId: "",
        fileEntities: [],
        id: "",
        investorAnnex: "",
        investorFileEntities: [],
        isSelf: 0,

        params: {},
        planInstalledCapacity: "",
        projectType: "",
        remark: "",
        roof: "",
        searchValue: "",
        selfAnnex: "",
        selfFileEntities: [],
        surveyReportId: "",
        updateBy: "",
        updateTime: "",
        userId: "",
      },
    };
  },
  methods: {
    onSubmit() {
      editRevenueList(this.formObject).then((res) => {
        if (res.code === 200) {
          this.$message({
            message: "修改成功！",
            type: "success",
          });
          this.$router.push({ path: "/Survey/SurveyRevenue" });
        }
      });
    },
    getData(id) {
      getDetailRevenueList(id).then((res) => {
        if (res.code === 200) {
          let data = res.data;
          Object.keys(this.formObject).forEach((key) => {
            this.formObject[key] = data[key];
          });
        }
      });
    },
  },
  created() {
    this.getData(this.$route.query.id);
  },
};
</script>
<style lang="scss" scoped></style>
